import Vue from 'vue'
import Vuex from 'vuex'
import A from './modules/A/a'

Vue.use(Vuex)



export default new Vuex.Store({
  strict: true,
  state: {
    count: 1000,
    count2: 1000,
    count3: 1000,
    count4: 1000,
    count5: 1000,
    count6: 1000,
  },
  mutations: {
    add(state, option) {
      // let n = Math.random() * 10000
      // setTimeout(() => {
      state.count += option.n
      // }, n);
    }
  },
  actions: {
    add(store, option) {
      setTimeout(() => {
        store.commit('add', { n: option })
      }, 1000);
    }
  },
  getters: {
    // 就是vuex的计算属性
    type(state) {
      // 只有count发生改变的时候 才会触发
      return state.count + 'type'
    }
  },
  modules: {
    MYA: A
  }

})
